package com.yl.users.entity

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import com.yl.common.annotation.NoArg
import com.yl.common.getContext
import java.util.*

@NoArg
@TableName("company_dept")
data class CompanyDept(

	/**
	 * 店铺id
	 */
	@TableId(value = "id", type = IdType.AUTO)
	var id: Long = 0,

	/**
	 * 店铺名称
	 */
	@TableField("name")
	var name: String,

	/**
	 * 店铺电话（考虑数组形式）
	 */
	@TableField("phone")
	var phone: String? = null,

	/**
	 * 地址
	 */
	@TableField("address")
	var address: String? = null,

	/**
	 * 地址坐标
	 */
	@TableField("address_point")
	var addressPoint: String? = null,

	/**
	 * 上级部门id
	 */
	@TableField("super_dept_id")
	var superDeptId: Long = 0,

	@TableField(exist = false)
	var superDeptName: String? = null,

	/**
	 * 数据有效性
	 */
	@TableField("enabled")
	var enabled: Int = 1,

	/**
	 * 所属医院id
	 */
	@TableField("company_id")
	var companyId: Long = getContext().companyId,

	@TableField("dept_code")
	var deptCode: String? = null,

	@TableField(exist = false)
	var superDept: CompanyDept? = null,

	/**
	 * 是否为分部
	 */
	@TableField("sub_company")
	var subCompany:Int = 0,

	@TableField("sub_company_id")
	var subCompanyId:Long = 0,


	@TableField(exist = false)
	var children: MutableList<CompanyDept> ?= null,
)
